function updateProductView() {
	this.parent();
}

function createCheckboxElements() {
	var ip = document.createElement("input");
	ip.setAttribute("type", "checkbox");
	return ip;
}

updateProductView.inherits(BaseView, {
	init : function() {
		var data = new CategoriesModel().createModel();
		this.createCateNode(data.categories, this.ctrl.model.cate);
		this.createUpdateProductView(this.ctrl.model.id, this.ctrl.model.bname, this.ctrl.model.author, this.ctrl.model.price, this.ctrl.model.des, this.ctrl.model.quan, this.ctrl.model.urlImg)
	},

	createCateNode : function(arrCate, category) {
		var rootNode = $id("loadcategory");
		var nodeCateName = null;
		var nodeOption = null;
		var nodeDiv = null;
		var cate = null;
		var length = arrCate.length;
		rootNode.innerHTML = "";

		for (var i = 0; i < length; i++) {
			cate = arrCate[i];

			nodeOption = createNode("option");
			nodeOption.text = cate.categoryName;
			nodeOption.value = cate.categoryId;
			rootNode.appendChild(nodeOption);
		}
		//check category
		var opts = rootNode.options.length;
		for (var i = 0; i < length; i++) {
			if (rootNode.options[i].value == category) {
				rootNode.selectedIndex = i;
				break;
			}
		}
	},

	createUpdateProductView : function(id, bookname, author, price, des, quan, urlImage) {
		$id("txtUpdateBookId").value = id;
		$id("txtUpdateBookName").value = bookname;
		$id("txtUpdateBookAuthor").value = author;
		$id("txtUpdateBookPrice").value = price;
		$id("txtUpdateBookDes").value = des;
		$id("txtUpdateBookQuantity").value = quan;
		$id("oldImg").innerHTML = urlImage;
		$id("btnUpdateProduct").setAttribute("onclick", "onclickbtnUpdateProduct()");
	}
});
